<template>
    <div class="allocation">
        <wrapper-content pageTitle="手动入|扣款">
            <div class="data-content">
                <Form ref="manual" :model="manual" label-position="right" :label-width="100" :rules="ruleValidate">
                    <FormItem label="操作类型：" prop="type" v-if="typeshow">
                        <Select v-model="manual.type" placeholder="">
                            <Option value="in">入款</Option>
                            <Option value="cut">扣款</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="用 户 名：" prop="username">
                        <Input v-model="manual.username" />
                    </FormItem>
                    <FormItem label="代 理 商：" prop="agency">
                        <Select v-model="manual.agency" >
                            <Option v-for="item in manual.agency" :value="item.value" :key="item.value">{{ item.label }}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="明细类型：" prop="select_type2">
                        <Select v-model="manual.select_type2" >
                            <Option v-for="item in manual.type2" :value="item.value" :key="item.value">{{ item.label }}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="发生金额：" prop="money">
                        <Input v-model="manual.money" />
                    </FormItem>
                    <FormItem label="备注：" prop="mark">
                        <Input v-model="manual.mark" type="textarea"/>
                    </FormItem>
                    <FormItem>
                        <Button type="primary" @click="handleSubmit('manual')">确定</Button>
                    </FormItem>
                </Form>
            </div>
        </wrapper-content>

    </div>
</template>
<style>
    .c666{
        color: #666;
    }
    .allocation .ivu-table-cell{
        padding: 0;
    }
</style>
<script>
    import WrapperContent from '../../../components/wrapper-content.vue'
    import {getUserList, getUser, getLevelList, getPositionList,doUserInfo,delUser,changeUserState} from "@/api/user";
    import * as utils from '../../../assets/js/utils'
    import $ from 'jquery'
    import _ from 'lodash'

    export default {
        components: {
            WrapperContent,
        },
        data() {
            return {
                typeshow:false,
                manual:{
                    type:'in',
                    username:'',
                    agency:[],
                    select_agency:'',
                    type2:[
                        {
                            value:'recharge',
                            label:'充值'
                        },
                        {
                            value:'service',
                            label:'服务费'
                        },
                        {
                            value:'other',
                            label:'其他'
                        },
                        {
                            value:'deposit',
                            label:'提现'
                        },
                        {
                            value:'earning',
                            label:'推广收益'
                        }
                    ],
                    select_type2:'recharge',
                    money:'',
                    mark:''
                },
                ruleValidate: {
                    username: [
                        {required: true, message: '用户名不能为空', trigger: 'blur'}
                    ],
                    agency: [
                        {required: true, message: '代理商不能为空', trigger: 'blur'}
                    ],
                    money: [
                        {required: true, message: '发生金额不能为空', trigger: 'blur'}
                    ],
                    mark: [
                        {required: true, message: '备注不能为空', trigger: 'blur'}
                    ],
                },
            }
        },
        mounted(){
            if(this.$route.meta.parent){
                this.typeshow = false;
            }else{
                this.typeshow = true ;
            }
        },
        methods: {
            handleSubmit (name) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.$Message.success('Success!');
                    } else {
                        this.$Message.error('Fail!');
                    }
                })
            },
        },
    }
</script>















